export default class ScorePanel {
    constructor(maxLevel = 10, updataLevel = 10) {
        this.isPuash = false;
        this.element = document.querySelector("#score_panel");
        this.score = this.element.querySelector(".score");
        this.level = this.element.querySelector(".level");
        this.contronalBtn = this.element.querySelector(".btn_open");
        this.maxLevel = maxLevel;
        this.updataLevel = updataLevel;
    }
    init() {
        this.contronalBtn.addEventListener("click", this.btnHandle.bind(this));
    }
    addScore() {
        const score = +this.score.innerHTML + 1;
        if (score % this.updataLevel === 0)
            this.addLevel();
        this.score.innerHTML = score + "";
    }
    addLevel() {
        const level = +this.level.innerHTML + 1;
        if (level > this.maxLevel)
            return;
        this.level.innerHTML = level + "";
    }
    ;
    btnHandle(e) {
        if (this.contronalBtn.innerText === "start") {
            this.contronalBtn.innerText = "puash";
            this.isPuash = false;
        }
        else {
            this.contronalBtn.innerText = "start";
            this.isPuash = true;
        }
    }
}
